//
//  YSMeYuViewController.m
//  YouSheng
//
//  Created by Mac on 16/8/25.
//  Copyright © 2016年 FanShuHan. All rights reserved.
//

#import "YSMeYuViewController.h"
#import <Masonry.h>

#define YSBJColorLan [UIColor colorWithRed:78/255.0 green:204/255.0 blue:190/255.0 alpha:1]

@interface YSMeYuViewController ()

@end

@implementation YSMeYuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController setNavigationBarHidden:NO];
//    self.navigationController.navigationBar.backgroundColor = [UIColor redColor];
    self.keyongYue = 100;
    self.jinriShouyi = 20;
    self.leijiShouyi = 420;
    
    [self setupUI];
}

//搭建界面
- (void)setupUI {
    //label
    UILabel *tsLab = [[UILabel alloc] init];
    tsLab.text = @"当前可用余额";
    tsLab.textColor = [UIColor grayColor];
    tsLab.font = [UIFont systemFontOfSize:18];
    
    [self.view addSubview:tsLab];
    
    [tsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(110);
        make.centerX.equalTo(self.view);
        
    }];
    
    //可用余额
    UILabel *kkyeLab = [[UILabel alloc] init];
    kkyeLab.text = [NSString stringWithFormat:@"%.2f",self.keyongYue];
    kkyeLab.textColor = YSBJColorLan;
    kkyeLab.font = [UIFont systemFontOfSize:40];
    
    [self.view addSubview:kkyeLab];
    
    [kkyeLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(tsLab.mas_bottom).offset(20);
        make.centerX.equalTo(self.view);
    }];
    
    //今日收益
    UILabel *jrsyLab = [[UILabel alloc] init];
    jrsyLab.text = @"今日收益";
    jrsyLab.textColor = [UIColor grayColor];
    jrsyLab.font = [UIFont systemFontOfSize:14];
    
    [self.view addSubview:jrsyLab];
    
    [jrsyLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(kkyeLab.mas_bottom).offset(100);
        make.left.mas_equalTo(50);
        
    }];
    
    //今日收益数
    UILabel *shouyiLab = [[UILabel alloc] init];
    shouyiLab.text = [NSString stringWithFormat:@"%.2f",self.jinriShouyi];
    shouyiLab.textColor = [UIColor grayColor];
    shouyiLab.font = [UIFont systemFontOfSize:14];
    
    [self.view addSubview:shouyiLab];
    
    [shouyiLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(jrsyLab.mas_bottom).offset(10);
        make.centerX.equalTo(jrsyLab.mas_centerX);
        
    }];
    
    //累计收益
    UILabel *ljLab = [[UILabel alloc] init];
    ljLab.text = @"累计收益";
    ljLab.textColor = [UIColor grayColor];
    ljLab.font = [UIFont systemFontOfSize:14];
    
    [self.view addSubview:ljLab];
    
    [ljLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(kkyeLab.mas_bottom).offset(100);
        make.right.mas_equalTo(-50);
        
    }];
    
    //累计收益数
    UILabel *zongshouyiLab = [[UILabel alloc] init];
    zongshouyiLab.text = [NSString stringWithFormat:@"%.2f",self.leijiShouyi];
    zongshouyiLab.textColor = [UIColor grayColor];
    zongshouyiLab.font = [UIFont systemFontOfSize:14];
    
    [self.view addSubview:zongshouyiLab];
    
    [zongshouyiLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(ljLab.mas_bottom).offset(10);
        make.centerX.equalTo(ljLab.mas_centerX);
        
    }];
    
    //充值按钮
    UIButton *czBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    czBtn.layer.cornerRadius = 5;
    [czBtn setTitle:@"充值" forState:UIControlStateNormal];
    [czBtn setTitleColor:[UIColor grayColor] forState:UIControlStateHighlighted];
    [czBtn setBackgroundColor:YSBJColorLan];
    
    [czBtn addTarget:self action:@selector(czBtnClick) forControlEvents:UIControlEventTouchUpInside];
    
    [self.view addSubview:czBtn];
    
    [czBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.view.mas_bottom).offset(-64);
        make.left.equalTo(self.view).offset(20);
        make.right.equalTo(self.view).offset(-20);
        make.height.mas_equalTo(44);
    }];
    
    //label2
    UILabel *ddLab = [[UILabel alloc] init];
    ddLab.text = @"收到的礼物都会转化为收益";
    ddLab.textColor = [UIColor grayColor];
    ddLab.font = [UIFont systemFontOfSize:14];
    
    [self.view addSubview:ddLab];
    
    [ddLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(czBtn.mas_top).offset(-40);
        make.centerX.equalTo(self.view);
        
    }];



}

//充值按钮点击
- (void)czBtnClick {
    NSLog(@"点击了充值按钮");
}

@end
